package com.tencent.shadow.sample.host.vm;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.meichis.mcsappframework.utils.SharePreferenceUtil;
import com.tencent.shadow.sample.host.model.UserInfo;

/**
 * @author xmy
 * @title
 * @remake
 * @create 2021-03-11 12:49
 */
public class MyViewModel extends ViewModel {

    private MutableLiveData<Boolean> showDialog;
    private MutableLiveData<UserInfo> userInfo;

    public SharePreferenceUtil util = SharePreferenceUtil.getInstance();


    public MutableLiveData<Boolean> getShowDialog() {
        if (showDialog == null) {
            showDialog = new MutableLiveData<>();
            showDialog.setValue(false);
        }
        return showDialog;
    }

    public MutableLiveData<UserInfo> getUserInfo() {
        if (userInfo == null) {
            userInfo = new MutableLiveData<>();
            userInfo.setValue((UserInfo) util.getObjectValue(SharePreferenceUtil.PREFERENCES_USERINFO));
        }
        return userInfo;
    }

}
